<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function setCookie(name, value, expires) {
            let str = name + "=" + value;
            if (typeof expires === "number") {
                let date = new Date();
                date.setDate(date.getDate() + expires);
                str += ";expires=" + date
            }
            document.cookie = str;
        }


        function getCookie(name) {
            let arr = document.cookie.split("; ");
            arr.forEach((item, index) => {
                item = item.split("=");
                if (item[0] == name) {
                    console.log(item[1])

                }
            })
        }

        getCookie("asd")

        function removeCookie(name) {
            setCookie(name, "", -1)
        }

    </script>
</body>

</html>